home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 November / Maximum CD 2000 Nov.iso / AofE-Conquerers / age2xtrial.exe / CABFILE / MSGAME.CAB / Data / gamedata_x1.drs / Unnamed File 000003.bina < prev    next >
Text File  |  2000-07-18  |  29KB  |  1,387 lines

  1. ;starting goals
  2. (defrule
  3.     (true)
  4. =>
  5.     (set-goal military-parity YES)    ;goal 3
  6.     (set-goal attack-control NO)    ;goal 4
  7.     (set-goal resource-needed NO)    ;goal 5
  8.  
  9.     (set-goal rush-control NOTICE)    ;goal 6
  10.     (set-goal secondary-build NO)    ;goal 8
  11.     (set-goal combat-arm NOTICE)    ;goal 11
  12.  
  13.     (set-goal soldiers-available NO);goal 10
  14.     (set-goal combat-supp UNIT20)    ;goal 12
  15.     (set-goal attack-enabled YES)    ;goal 13
  16.     (set-goal age-advancement NO)    ;goal 14
  17.  
  18.     (disable-self)
  19. )
  20.  
  21. (defrule
  22.     (true)
  23. =>
  24.     (set-goal upgrade-conflict NO)    ;goal 16
  25.     (set-goal wonder-attempt MAYBE)    ;goal 20
  26.     (set-goal sea-owner NO)            ;goal 23
  27.     (set-goal enemy-soldiers NO)    ;goal 26
  28.  
  29.     (set-goal get-mad NO)            ;goal 28
  30.     (set-goal siege-available YES)    ;goal 34
  31.     (disable-self)
  32. )
  33.  
  34. ;starting loads
  35.  
  36. (load "petersen civ loads")
  37. (load "petersen difficulty loads")
  38. (load "petersen gather")
  39.  
  40. (load "petersen upgrades")
  41. (load "petersen castle")
  42. (load "petersen full tech")
  43.  
  44. (load "petersen rush")
  45.  
  46.  
  47. ;========================DARK AGE RULES
  48. (defrule
  49.     (true)
  50. =>
  51.     (set-strategic-number sn-coop-share-information 1)
  52.     (set-strategic-number sn-coop-share-attacking 1)
  53.     (set-strategic-number sn-maximum-town-size 15)
  54.  
  55.     (set-strategic-number sn-task-ungrouped-soldiers 0)
  56.     (set-strategic-number sn-zero-priority-distance 250)
  57.     (set-strategic-number sn-blot-exploration-map 0)
  58.  
  59.     (set-strategic-number sn-attack-intelligence 1)
  60.     (set-strategic-number sn-gather-defense-units 1)
  61.     (set-strategic-number sn-defense-distance 2)
  62.  
  63.     (set-strategic-number sn-maximum-gaia-attack-response 2)
  64.     (set-strategic-number sn-ignore-attack-group-under-attack 0)
  65. ;    (set-strategic-number sn-minimum-boar-hunt-group-size 5)
  66.     (disable-self)
  67. )
  68.  
  69. (defrule
  70.     (true)
  71. =>
  72.     (set-strategic-number sn-stone-dropsite-distance 3)
  73.     (set-strategic-number sn-gold-dropsite-distance 3)
  74.     (set-strategic-number sn-retask-gather-amount 20)
  75.     (set-strategic-number sn-camp-max-distance 20)
  76.  
  77.     (set-strategic-number sn-mill-max-distance 20)
  78.     (set-strategic-number sn-enemy-sighted-response-distance 10)
  79.     (set-strategic-number sn-group-form-distance 10)
  80.  
  81.     (set-strategic-number sn-allow-civilian-defense 1)
  82.     (set-strategic-number sn-garrison-rams 1)
  83.     (disable-self)
  84. )
  85.  
  86. (defrule
  87.     (true)
  88. =>
  89.     (set-strategic-number sn-town-defend-priority 1)
  90.     (set-strategic-number sn-gold-defend-priority 2)
  91.     (set-strategic-number sn-stone-defend-priority 3)
  92.  
  93.     (set-strategic-number sn-forage-defend-priority 0)
  94.     (set-strategic-number sn-relic-defend-priority 0)
  95.     (set-strategic-number sn-cap-civilian-builders 8)
  96.  
  97.     (set-strategic-number sn-cap-civilian-gatherers 100)
  98.     (disable-self)
  99. )
  100.  
  101. (defrule
  102.     (not (map-type nomad) )
  103. =>
  104.     (set-strategic-number sn-minimum-civilian-explorers 0)
  105.     (set-strategic-number sn-cap-civilian-explorers 0)
  106.     (set-strategic-number sn-percent-civilian-explorers 0)
  107.     (disable-self)
  108. )
  109.  
  110. (defrule
  111.     (true)
  112. =>
  113.     (set-strategic-number sn-maximum-wood-drop-distance 20)
  114.     (set-strategic-number sn-maximum-food-drop-distance 8)
  115.     (set-strategic-number sn-maximum-hunt-drop-distance 30)
  116.  
  117.     (set-strategic-number sn-maximum-fish-boat-drop-distance 30)
  118.     (set-strategic-number sn-maximum-gold-drop-distance 20)
  119.     (set-strategic-number sn-maximum-stone-drop-distance 20)
  120.     (disable-self)
  121. )
  122.  
  123. #load-if-defined KING-OF-THE-HILL
  124.  
  125. (defrule
  126.     (hold-koh-ruin)
  127. =>
  128.     (set-strategic-number sn-gather-idle-soldiers-at-center 1)
  129. )
  130.  
  131. (defrule
  132.     (not (hold-koh-ruin) )
  133.     (military-population < twenty-percent-pop)
  134. =>
  135.     (set-strategic-number sn-gather-idle-soldiers-at-center 0)
  136. )
  137.  
  138. (defrule
  139.     (not (hold-koh-ruin) )
  140.     (military-population > thirty-percent-pop)
  141. =>
  142.     (set-strategic-number sn-gather-idle-soldiers-at-center 1)
  143. )
  144.  
  145. #load-if-not-defined DIFFICULTY-EASIEST
  146. #load-if-not-defined DIFFICULTY-EASY
  147. #load-if-not-defined DIFFICULTY-MODERATE
  148. (defrule
  149.     (current-age == dark-age)
  150. =>
  151.     (cc-add-resource wood 100)
  152.     (cc-add-resource food 100)
  153.     (cc-add-resource gold 100)
  154.     (cc-add-resource stone 100)
  155.     (disable-self)
  156. )    
  157.  
  158. (defrule
  159.     (current-age == feudal-age)
  160. =>
  161.     (cc-add-resource wood 200)
  162.     (cc-add-resource food 200)
  163.     (cc-add-resource gold 200)
  164.     (cc-add-resource stone 200)
  165.     (disable-self)
  166. )    
  167.  
  168. (defrule
  169.     (current-age == castle-age)
  170. =>
  171.     (cc-add-resource wood 500)
  172.     (cc-add-resource food 500)
  173.     (cc-add-resource gold 500)
  174.     (cc-add-resource stone 500)
  175.     (disable-self)
  176. )    
  177.  
  178. (defrule
  179.     (current-age == imperial-age)
  180. =>
  181.     (cc-add-resource wood 1000)
  182.     (cc-add-resource food 1000)
  183.     (cc-add-resource gold 1000)
  184.     (cc-add-resource stone 1000)
  185.     (disable-timer t-chatmore)
  186.     (enable-timer t-chatmore 1800)
  187.     (disable-self)
  188. )    
  189.  
  190. (defrule
  191.     (timer-triggered t-chatmore)
  192. =>
  193.     (cc-add-resource wood 500)
  194.     (cc-add-resource food 500)
  195.     (cc-add-resource gold 500)
  196.     (cc-add-resource stone 500)
  197.     (disable-timer t-chatmore)
  198.     (enable-timer t-chatmore 1200)
  199. )
  200.  
  201. #end-if
  202. #end-if
  203. #end-if
  204. #end-if
  205.  
  206. ;start exploring
  207. (defrule
  208.     (not (map-type nomad) )
  209.     (or
  210.         (game-time > 600)
  211.         (and
  212.             (starting-resources < high-resources)
  213.             (difficulty > hardest)
  214.         )
  215.     )
  216. =>
  217.     (set-strategic-number sn-percent-civilian-builders 15)
  218.     (set-strategic-number sn-percent-civilian-gatherers 85)
  219.     (disable-self)
  220. )
  221.  
  222. (defrule
  223.     (not (map-type nomad) )
  224.     (or
  225.         (starting-resources == high-resources)
  226.         (difficulty == hardest)
  227.     )
  228. =>
  229.     (set-strategic-number sn-percent-civilian-builders 85)
  230.     (set-strategic-number sn-percent-civilian-gatherers 15)
  231.     (disable-self)
  232. )
  233.  
  234. ; explore a bit at need
  235. (defrule
  236.     (not (map-type nomad) )
  237.     (game-time < 600)
  238.     (military-population == 0)
  239.     (civilian-population < 15)
  240.     (or
  241.         (dropsite-min-distance food == -1)
  242.         (civilian-population > 10)
  243.     )
  244. =>
  245.     (set-strategic-number sn-minimum-civilian-explorers 1)
  246.     (set-strategic-number sn-cap-civilian-explorers 1)
  247.     (set-strategic-number sn-percent-civilian-explorers 5)
  248.     (set-strategic-number sn-percent-civilian-builders 15)
  249.     (set-strategic-number sn-percent-civilian-gatherers 80)
  250. )
  251.  
  252. ; Shut the explorers off when we get enough food
  253. (defrule
  254.     (not (map-type nomad) )
  255.     (strategic-number sn-percent-civilian-explorers > 0)
  256.     (or
  257.         (or
  258.             (game-time > 900)
  259.             (dropsite-min-distance food > -1)
  260.         )
  261.         (military-population > 0)
  262.     )
  263. =>
  264.     (set-strategic-number sn-percent-civilian-explorers 0)
  265.     (set-strategic-number sn-minimum-civilian-explorers 0)
  266.     (set-strategic-number sn-cap-civilian-explorers 0)
  267.     (set-strategic-number sn-percent-civilian-builders 15)
  268.     (set-strategic-number sn-percent-civilian-gatherers 85)
  269. )
  270.  
  271. (defrule
  272.     (or
  273.         (players-current-age any-enemy > feudal-age)
  274.         (players-military-population any-enemy > 2)
  275.     )
  276. =>
  277.     (set-strategic-number sn-allow-civilian-defense 0)
  278.     (disable-self)
  279. )
  280.  
  281. ; villager count
  282. (defrule
  283.     (current-age == dark-age)
  284.     (difficulty <= hard)
  285.     (unit-type-count-total villager < 27)
  286.     (or
  287.         (goal rush-control CASTLE)
  288.         (goal rush-control IMPERIAL)
  289.     )
  290.     (can-train villager)
  291. =>
  292.     (train villager)
  293. )
  294.  
  295. (defrule
  296.     (current-age == dark-age)
  297.     (difficulty <= hard)
  298.     (civilian-population < civ-dark)
  299.     (nor
  300.         (goal rush-control CASTLE)
  301.         (goal rush-control IMPERIAL)
  302.     )
  303.     (can-train villager)
  304. =>
  305.     (train villager)
  306. )
  307.  
  308. (defrule
  309.     (current-age == dark-age)
  310.     (difficulty == moderate)
  311.     (civilian-population < civ-dark-mod)
  312.     (can-train villager)
  313. =>
  314.     (train villager)
  315. )
  316.  
  317. ;maintain housing
  318. (defrule
  319.     (building-type-count house == 0)
  320.     (building-type-count town-center > 0)
  321.     (can-build house)
  322. =>
  323.     (build house)
  324. )
  325.  
  326. (defrule
  327.     (building-type-count town-center > 0)
  328.     (difficulty <= moderate)
  329.     (housing-headroom < 5)
  330.     (population-headroom > 0)
  331.     (can-build house)
  332. =>
  333.     (build house)
  334. )
  335.  
  336. #load-if-defined DIFFICULTY-EASIEST
  337. (defrule
  338.     (building-type-count town-center > 0)
  339.     (military-population < 10)
  340.     (housing-headroom < 5)
  341.     (population-headroom > 0)
  342.     (can-build house)
  343. =>
  344.     (build house)
  345. )
  346.  
  347. (defrule
  348.     (unit-type-count-total villager <= 5)
  349.     (can-train villager)
  350. =>
  351.     (train villager)
  352. )
  353.  
  354. #end-if
  355.  
  356. #load-if-defined DIFFICULTY-EASY
  357. (defrule
  358.     (building-type-count town-center > 0)
  359.     (military-population < civ-dark-rush)
  360.     (housing-headroom < 5)
  361.     (population-headroom > 0)
  362.     (can-build house)
  363. =>
  364.     (build house)
  365. )
  366.  
  367. (defrule
  368.     (unit-type-count-total villager <= 10)
  369.     (can-train villager)
  370. =>
  371.     (train villager)
  372. )
  373.  
  374. #end-if
  375.  
  376. ;maintain a town center
  377. (defrule
  378.     (not (map-type nomad) )
  379.     (building-type-count town-center < 1)
  380.     (can-build town-center)
  381. =>
  382.     (build town-center)
  383. )
  384.  
  385. ; Build a mill when we find food
  386. (defrule
  387.     (building-type-count-total mill == 0)
  388.     (building-type-count town-center > 0)
  389.     (or
  390.         (building-type-count-total house > 0)
  391.         (civ-selected hun)
  392.     )
  393.     (or
  394.         (resource-found food)
  395.         (or
  396.             (map-type scandanavia)
  397.             (game-time > 450)
  398.         )
  399.     )
  400.     (can-build mill)
  401. =>
  402.     (build mill)
  403. )
  404.  
  405. (defrule
  406.     (game-time > 90)
  407.     (resource-found wood)
  408.     (building-type-count town-center > 0)
  409.     (building-type-count-total mill > 0)
  410.     (or
  411.         (or
  412.             (building-type-count-total house > 1)
  413.             (civ-selected chinese)
  414.         )
  415.         (or
  416.             (civ-selected hun)
  417.             (building-type-count castle > 0)
  418.         )
  419.     )
  420.     (building-type-count-total lumber-camp == 0)
  421.     (can-build lumber-camp)
  422. =>
  423.     (build lumber-camp)
  424. )
  425.  
  426. ;build farms
  427. (defrule
  428.     (building-type-count-total lumber-camp > 0)
  429.     (building-type-count-total mill > 0)
  430.     (idle-farm-count <= 1)
  431.     (sheep-and-forage-too-far)
  432.     (can-build farm)
  433.     (not (goal wonder-attempt YES) )
  434.     (or
  435.         (wood-amount > 400)
  436.         (and
  437.             (building-type-count-total market > 0)
  438.             (building-type-count-total blacksmith > 0)
  439.         )
  440.     )
  441. =>
  442.     (build farm)
  443. )
  444.  
  445. (defrule
  446.     (building-type-count-total lumber-camp > 0)
  447.     (building-type-count-total mill > 0)
  448.     (can-build farm)
  449.     (building-type-count-total farm < 10)
  450.     (not (goal wonder-attempt YES) )
  451.     (or
  452.         (goal rush-control CASTLE)
  453.         (goal rush-control IMPERIAL)
  454.     )
  455. =>
  456.     (build farm)
  457. )
  458.  
  459. (defrule
  460.     (building-type-count-total barracks == 0)
  461.     (can-build-with-escrow barracks)
  462.     (building-type-count-total lumber-camp > 0)
  463.     (building-type-count-total mill > 0)
  464.     (nor
  465.         (goal rush-control CASTLE)
  466.         (goal rush-control IMPERIAL)
  467.     )
  468. =>
  469.     (release-escrow wood)
  470.     (build barracks)
  471. )
  472.  
  473. (defrule
  474.     (building-type-count-total barracks == 1)
  475.     (can-build-with-escrow barracks)
  476.     (goal rush-control RUSHING)
  477.     (unit-type-count villager > civ-dark-mod)
  478.     (not (goal 1 10) )
  479. =>
  480.     (release-escrow wood)
  481.     (build-forward barracks)
  482. )
  483.  
  484. (defrule
  485.     (current-age == dark-age)
  486.     (building-type-count-total mining-camp == 0)
  487.     (resource-found gold)
  488.     (current-age == dark-age)
  489.     (civilian-population >= 10)
  490.     (can-build mining-camp)
  491.     (nor 
  492.         (goal rush-control CASTLE)
  493.         (goal rush-control IMPERIAL)
  494.     )
  495. =>
  496.     (build mining-camp)
  497. )
  498.  
  499.  
  500. ;=======================FEUDAL AGE RULES
  501. (defrule
  502.     (current-age >= feudal-age)
  503. =>
  504.     (set-strategic-number sn-maximum-town-size feudal-town-size)
  505.     (set-strategic-number sn-percent-civilian-builders 15)
  506.     (set-strategic-number sn-percent-civilian-gatherers 85)
  507.  
  508.     (set-strategic-number sn-camp-max-distance 35)
  509.     (set-strategic-number sn-mill-max-distance 35)
  510.     (set-strategic-number sn-group-form-distance 20)
  511.  
  512.     (set-strategic-number sn-enemy-sighted-response-distance 10)
  513.     (set-strategic-number sn-ignore-attack-group-under-attack 1)
  514.     (disable-self)
  515. )
  516.  
  517. (defrule
  518.     (current-age == feudal-age)
  519.     (gold-amount < 200)
  520.     (can-sell-commodity stone)
  521.     (commodity-selling-price stone >= 50)
  522.     (or
  523.         (goal rush-control CASTLE)
  524.         (goal rush-control IMPERIAL)
  525.     )
  526. =>
  527.     (sell-commodity stone)
  528. )
  529.  
  530. (defrule
  531.     (current-age >= feudal-age)
  532. =>
  533.     (set-goal combat-supp UNIT20)
  534.     (set-goal age-advancement NO)
  535.     (enable-timer t-production 1)
  536.     (enable-timer t-lumbercamp 1)
  537.     (disable-timer t-ageup)
  538.     (disable-self)
  539. )
  540.  
  541. (defrule
  542.     (building-type-count-total barracks == 0)
  543.     (building-type-count-total lumber-camp > 0)
  544.     (building-type-count-total mill > 0)
  545.     (can-build-with-escrow barracks)
  546.     (or
  547.         (goal rush-control CASTLE)
  548.         (goal rush-control IMPERIAL)
  549.     )
  550.     (or
  551.         (difficulty > moderate)
  552.         (building-type-count-total town-center > 1)
  553.     )
  554. =>
  555.     (release-escrow wood)
  556.     (build barracks)
  557. )
  558.  
  559. (defrule
  560.     (current-age == feudal-age)
  561.     (current-age-time < 600)
  562.     (wood-amount > 500)
  563. =>
  564.     (set-strategic-number sn-percent-civilian-builders 50)
  565.     (set-strategic-number sn-percent-civilian-gatherers 50)
  566.     (disable-self)
  567. )
  568.  
  569. (defrule
  570.     (current-age == feudal-age)
  571.     (current-age-time >= 600)
  572. =>
  573.     (set-strategic-number sn-percent-civilian-builders 15)
  574.     (set-strategic-number sn-percent-civilian-gatherers 85)
  575.     (disable-self)
  576. )
  577.  
  578. ; villager count
  579. (defrule
  580.     (current-age == feudal-age)
  581.     (difficulty <= hard)
  582.     (unit-type-count-total villager < 29)
  583.     (or
  584.         (goal rush-control CASTLE)
  585.         (goal rush-control IMPERIAL)
  586.     )
  587.     (can-train villager)
  588. =>
  589.     (train villager)
  590. )
  591.  
  592. (defrule
  593.     (current-age == feudal-age)
  594.     (difficulty <= hard)
  595.     (civilian-population < civ-feudal)
  596.     (nor
  597.         (goal rush-control CASTLE)
  598.         (goal rush-control IMPERIAL)
  599.     )
  600.     (can-train villager)
  601. =>
  602.     (train villager)
  603. )
  604.  
  605. (defrule
  606.     (current-age == feudal-age)
  607.     (difficulty == moderate)
  608.     (civilian-population < civ-feudal-mod)
  609.     (can-train villager)
  610. =>
  611.     (train villager)
  612. )
  613.  
  614. ;periodically task idle guys, so they don't clog up production
  615. (defrule
  616.     (timer-triggered t-lumbercamp)
  617.     (strategic-number sn-task-ungrouped-soldiers == 0)
  618. =>
  619.     (set-strategic-number sn-task-ungrouped-soldiers 1)
  620. )
  621.  
  622. (defrule
  623.     (timer-triggered t-lumbercamp)
  624.     (strategic-number sn-task-ungrouped-soldiers == 1)
  625. =>
  626.     (set-strategic-number sn-task-ungrouped-soldiers 0)
  627. )
  628.  
  629. ; Build camps at need
  630. (defrule
  631.     (timer-triggered t-lumbercamp)
  632.     (current-age >= feudal-age)
  633.     (resource-found wood)
  634.     (dropsite-min-distance wood > 5)
  635.     (can-build lumber-camp)
  636. =>
  637.     (build lumber-camp)
  638. )
  639.  
  640. (defrule
  641.     (current-age == feudal-age)
  642.     (resource-found gold)
  643.     (building-type-count-total mining-camp == 0)
  644.     (can-build-with-escrow mining-camp)
  645.     (stone-amount < 100)
  646.     (gold-amount < 200)
  647.     (or
  648.         (goal rush-control CASTLE)
  649.         (goal rush-control IMPERIAL)
  650.     )
  651. =>
  652.     (release-escrow wood)
  653.     (build mining-camp)
  654. )
  655.  
  656. (defrule
  657.     (current-age >= feudal-age)
  658.     (resource-found gold)
  659.     (building-type-count-total mining-camp == 0)
  660.     (can-build-with-escrow mining-camp)
  661.     (or
  662.         (goal age-advancement NOTICE)
  663.         (nor
  664.             (goal rush-control CASTLE)
  665.             (goal rush-control IMPERIAL)
  666.         )
  667.     )
  668. =>
  669.     (release-escrow wood)
  670.     (build mining-camp)
  671. )
  672.  
  673. (defrule
  674.     (current-age >= feudal-age)
  675.     (resource-found stone)
  676.     (building-type-count-total mining-camp == 1)
  677.     (can-build-with-escrow mining-camp)
  678.     (or
  679.         (goal age-advancement NOTICE)
  680.         (nor
  681.             (goal rush-control CASTLE)
  682.             (goal rush-control IMPERIAL)
  683.         )
  684.     )
  685. =>
  686.     (release-escrow wood)
  687.     (build mining-camp)
  688. )
  689.  
  690. (defrule
  691.     (timer-triggered t-lumbercamp)
  692.     (current-age >= feudal-age)
  693.     (building-type-count-total market > 0)
  694.     (building-type-count-total blacksmith > 0)
  695.     (building-type-count-total mining-camp >= 1)
  696.     (building-type-count-total mining-camp < mining-count)
  697.     (resource-found gold)
  698.     (resource-found stone)
  699.     (or
  700.         (dropsite-min-distance gold > 7)
  701.         (dropsite-min-distance stone > 7)
  702.     )
  703.     (can-build mining-camp)
  704. =>
  705.     (build mining-camp)
  706. )
  707.  
  708. (defrule
  709.     (timer-triggered t-lumbercamp)
  710. =>
  711.     (disable-timer t-lumbercamp)
  712.     (enable-timer t-lumbercamp 30)
  713. )
  714.  
  715. (defrule
  716.     (building-type-count-total archery-range == 0)
  717.     (or
  718.         (goal rush-control CASTLE)
  719.         (goal rush-control RUSHING)
  720.     )
  721.     (or
  722.         (or
  723.             (goal combat-arm CAVARCHER)
  724.             (goal combat-arm ARCHER)
  725.         )
  726.         (or
  727.             (goal pre-unique-arm CAVARCHER)
  728.             (goal pre-unique-arm ARCHER)
  729.         )
  730.     )
  731.     (can-build-with-escrow archery-range)
  732. =>
  733.     (release-escrow wood)
  734.     (build archery-range)
  735. )
  736.  
  737. (defrule
  738.     (goal combat-arm LIGHTCAV)
  739.     (building-type-count-total stable == 0)
  740.     (or
  741.         (goal rush-control CASTLE)
  742.         (goal rush-control RUSHING)
  743.     )
  744.     (can-build-with-escrow stable)
  745. =>
  746.     (release-escrow wood)
  747.     (build stable)
  748. )
  749.  
  750. ;feudal age market -- always keep a market handy!
  751. (defrule
  752.     (building-type-count-total market == 0)
  753.     (can-build-with-escrow market)
  754. =>
  755.     (release-escrow wood)
  756.     (build market)
  757. )
  758.  
  759. ;get a blacksmith
  760. (defrule
  761.     (building-type-count-total market > 0)
  762.     (can-build-with-escrow blacksmith)
  763.     (building-type-count-total blacksmith == 0)
  764.     (or
  765.         (building-type-count-total barracks > 0)
  766.         (or
  767.             (goal rush-control CASTLE)
  768.             (goal rush-control IMPERIAL)
  769.         )
  770.     )
  771. =>
  772.     (release-escrow wood)
  773.     (build blacksmith)
  774. )
  775.  
  776. (defrule
  777.     (building-type-count-total market > 0)
  778.     (building-type-count-total archery-range == 0)
  779.     (not (goal rush-control IMPERIAL) )
  780.     (or
  781.         (goal combat-arm CAVARCHER)
  782.         (goal combat-arm ARCHER)
  783.     )
  784.     (can-build-with-escrow archery-range)
  785. =>
  786.     (release-escrow wood)
  787.     (build archery-range)
  788. )
  789.  
  790. (defrule
  791.     (building-type-count-total market > 0)
  792.     (building-type-count-total archery-range == 0)
  793.     (not (goal rush-control IMPERIAL) )
  794.     (or
  795.         (or
  796.             (goal combat-supp CAVARCHER)
  797.             (goal combat-supp ARCHER)
  798.         )
  799.         (or
  800.             (goal pre-unique-arm CAVARCHER)
  801.             (goal pre-unique-arm ARCHER)
  802.         )
  803.     )
  804.     (can-build-with-escrow archery-range)
  805. =>
  806.     (release-escrow wood)
  807.     (build archery-range)
  808. )
  809.  
  810. (defrule
  811.     (building-type-count-total market > 0)
  812.     (building-type-count-total stable == 0)
  813.     (not (goal rush-control IMPERIAL) )
  814.     (or
  815.         (or
  816.             (goal combat-supp CAVALRY)
  817.             (goal combat-supp LIGHTCAV)
  818.         )
  819.         (or
  820.             (goal pre-unique-arm CAVALRY)
  821.             (goal pre-unique-arm LIGHTCAV)
  822.         )
  823.     )
  824.     (can-build-with-escrow stable)
  825. =>
  826.     (release-escrow wood)
  827.     (build stable)
  828. )
  829.  
  830. (defrule
  831.     (building-type-count-total market > 0)
  832.     (building-type-count-total stable == 0)
  833.     (not (goal rush-control IMPERIAL) )
  834.     (or
  835.         (goal combat-arm CAVALRY)
  836.         (goal combat-arm LIGHTCAV)
  837.     )
  838.     (can-build-with-escrow stable)
  839. =>
  840.     (release-escrow wood)
  841.     (build stable)
  842. )
  843. (defrule
  844.     (current-age >= feudal-age)
  845.     (current-age-time > 300)
  846.     (building-type-count-total mill < feudal-mill-count)
  847.     (wood-amount > 400)
  848.     (can-build mill)
  849. =>
  850.     (build mill)
  851. )
  852.  
  853. (defrule
  854.     (cc-players-building-type-count any-ally market > 0)
  855.     (unit-type-count-total trade-cart == 0)
  856.     (wood-amount > 300)
  857.     (gold-amount > 300)
  858.     (nor
  859.         (town-under-attack)
  860.         (and
  861.             (goal 1 10)
  862.             (not (map-type team-islands) )
  863.         )
  864.     )
  865.     (can-train trade-cart)
  866. =>
  867.     (train trade-cart)
  868.     (disable-self)
  869. )
  870.  
  871. (defrule
  872.     (current-age == imperial-age)
  873.     (cc-players-building-type-count any-ally market > 0)
  874.     (unit-type-count-total trade-cart == 0)
  875.     (wood-amount > 300)
  876.     (gold-amount > 300)
  877.     (nor
  878.         (town-under-attack)
  879.         (and
  880.             (goal 1 10)
  881.             (not (map-type team-islands) )
  882.         )
  883.     )
  884.     (can-train trade-cart)
  885. =>
  886.     (train trade-cart)
  887.     (disable-self)
  888. )
  889.  
  890. (defrule
  891.     (cc-players-building-type-count any-ally dock >= 1)
  892.     (unit-type-count-total trade-cog == 0)
  893.     (wood-amount > 300)
  894.     (gold-amount > 300)
  895.     (not (goal 1 0) )
  896.     (can-train trade-cog)
  897. =>
  898.     (train trade-cog)
  899.     (disable-self)
  900. )
  901.  
  902. (defrule
  903.     (current-age == imperial-age)
  904.     (cc-players-building-type-count any-ally dock >= 1)
  905.     (unit-type-count-total trade-cog == 0)
  906.     (wood-amount > 300)
  907.     (gold-amount > 300)
  908.     (not (goal 1 0) )
  909.     (can-train trade-cog)
  910. =>
  911.     (train trade-cog)
  912.     (disable-self)
  913. )
  914.  
  915. ;======================== CASTLE AGE RULES
  916. ;see age advancement rules for strategic number-settings
  917. (defrule
  918.     (current-age >= castle-age)
  919. =>
  920.     (set-strategic-number sn-sentry-distance 4)
  921.     (set-strategic-number sn-maximum-town-size castle-town-size)
  922.     (set-strategic-number sn-percent-civilian-builders 15)
  923.  
  924.     (set-strategic-number sn-percent-civilian-gatherers 85)
  925.     (set-strategic-number sn-blot-exploration-map 1)
  926.     (set-strategic-number sn-camp-max-distance 50)
  927.  
  928.     (set-strategic-number sn-mill-max-distance 50)
  929.     (set-strategic-number sn-group-form-distance 30)
  930.     (set-strategic-number sn-enemy-sighted-response-distance 15)
  931.  
  932.     (set-goal age-advancement NO)
  933.     (disable-timer t-ageup)
  934.  
  935.     (disable-self)
  936. )
  937.  
  938. ;second TC
  939. (defrule
  940.     (current-age >= castle-age)
  941.     (difficulty <= moderate)
  942.     (building-type-count-total town-center < 2)
  943.     (can-build-with-escrow town-center)
  944. =>
  945.     (release-escrow wood)
  946.     (release-escrow stone)
  947.     (build town-center)
  948. )
  949.  
  950. ; villager count
  951. (defrule
  952.     (current-age == castle-age)
  953.     (difficulty <= moderate)
  954.     (civilian-population < civ-castle)
  955.     (can-train villager)
  956. =>
  957.     (train villager)
  958. )
  959.  
  960. ;Siege Workshop
  961. (defrule
  962.     (building-type-count-total siege-workshop == 0)
  963.     (or
  964.         (difficulty > moderate)
  965.         (building-type-count-total town-center > 1)
  966.     )
  967.     (can-build-with-escrow siege-workshop)
  968. =>
  969.     (release-escrow wood)
  970.     (build siege-workshop)
  971. )
  972.  
  973. ;University & maintain it
  974. (defrule
  975.     (building-type-count-total university == 0)
  976.     (or
  977.         (building-type-count-total siege-workshop > 0)
  978.         (wood-amount > 500)
  979.     )
  980.     (or
  981.         (difficulty > moderate)
  982.         (building-type-count-total town-center > 1)
  983.     )
  984.     (can-build-with-escrow university)
  985. =>
  986.     (release-escrow wood)
  987.     (build university)
  988. )
  989.  
  990. ; Build a monastery
  991. (defrule
  992.     (building-type-count-total monastery == 0)
  993.     (or
  994.         (goal monk-rating GOOD)
  995.         (or
  996.             (building-type-count-total siege-workshop > 0)
  997.             (wood-amount > 500)
  998.         )
  999.     )
  1000.     (not (goal monk-rating NO) )
  1001.     (or
  1002.         (difficulty > moderate)
  1003.         (building-type-count-total town-center > 1)
  1004.     )
  1005.     (can-build-with-escrow monastery)
  1006. =>
  1007.     (release-escrow wood)
  1008.     (build monastery)
  1009. )
  1010.  
  1011. (defrule
  1012.     (goal monk-rating GOOD)
  1013.     (building-type-count-total monastery < 2)
  1014.     (building-type-count-total siege-workshop > 0)
  1015.     (can-build monastery)
  1016. =>
  1017.     (build monastery)
  1018. )
  1019.  
  1020. (defrule
  1021.     (current-age >= castle-age)
  1022.     (current-age-time > 300)
  1023.     (building-type-count-total mill < castle-mill-count)
  1024.     (wood-amount > 500)
  1025.     (or
  1026.         (difficulty > moderate)
  1027.         (building-type-count-total town-center > 1)
  1028.     )
  1029.     (can-build mill)
  1030. =>
  1031.     (build mill)
  1032. )
  1033.  
  1034. ;=============================IMPERIAL AGE RULES
  1035. ;see age advancement rules for strategic number-settings
  1036. (defrule
  1037.     (current-age == imperial-age)
  1038. =>
  1039.     (set-strategic-number sn-maximum-town-size imperial-town-size)
  1040.     (set-strategic-number sn-percent-civilian-builders 15)
  1041.     (set-strategic-number sn-percent-civilian-gatherers 85)
  1042.     (set-strategic-number sn-camp-max-distance 50)
  1043.  
  1044.     (set-strategic-number sn-mill-max-distance 50)
  1045.     (set-strategic-number sn-enemy-sighted-response-distance 15)
  1046.  
  1047.     (set-goal age-advancement NO)
  1048.     (disable-self)
  1049. )
  1050.  
  1051. (defrule
  1052.     (current-age == imperial-age)
  1053.     (difficulty <= moderate)
  1054.     (or
  1055.         (and
  1056.             (current-age-time < 1800)
  1057.             (civilian-population < civ-castle)
  1058.         )
  1059.         (civilian-population < civ-feudal)
  1060.     )
  1061.     (can-train villager)
  1062. =>
  1063.     (train villager)
  1064. )
  1065.  
  1066. (defrule
  1067.     (current-age == imperial-age)
  1068.     (population >= pop-cap)
  1069.     (or
  1070.         (and
  1071.             (current-age-time < 1800)
  1072.             (civilian-population > civ-castle)
  1073.         )
  1074.         (civilian-population > civ-feudal)
  1075.     )
  1076.     (not (goal rush-control BOOMING) )
  1077. =>
  1078.     (delete-unit villager)
  1079. )    
  1080.  
  1081. ;another town center?
  1082. (defrule
  1083.     (current-age == imperial-age)
  1084.     (difficulty <= hard)
  1085.     (building-type-count town-center < town-center-count)
  1086.     (wood-amount > 400)
  1087.     (stone-amount > 100)
  1088.     (can-build town-center)
  1089. =>
  1090.     (build town-center)
  1091. )
  1092.  
  1093. (defrule
  1094.     (current-age == imperial-age)
  1095.     (difficulty <= hard)
  1096.     (current-age-time > 300)
  1097.     (building-type-count-total mill < imperial-mill-count)
  1098.     (wood-amount > 700)
  1099.     (can-build mill)
  1100. =>
  1101.     (build mill)
  1102. )
  1103.  
  1104. ;****************
  1105. ;forward builders!
  1106. ; start the run-through for island maps
  1107. (defrule
  1108.     (goal 1 10)
  1109.     (goal rush-control RUSHING)
  1110.     (difficulty <= moderate)
  1111.     (building-type-count barracks == 1)
  1112.     (building-type-count-total blacksmith > 0)
  1113.     (strategic-number sn-number-forward-builders == 0)
  1114.     (unit-type-count villager >= civ-dark-rush)
  1115.     (goal combat-arm INFANTRY)
  1116. =>
  1117.     (set-strategic-number sn-number-forward-builders 1)
  1118. )
  1119.  
  1120. (defrule
  1121.     (goal 1 10)
  1122.     (goal rush-control RUSHING)
  1123.     (difficulty <= moderate)
  1124.     (building-type-count stable == 1)
  1125.     (building-type-count-total university > 0)
  1126.     (strategic-number sn-number-forward-builders == 0)
  1127.     (unit-type-count villager >= civ-dark-rush)
  1128.     (or
  1129.         (goal combat-arm CAVALRY)
  1130.         (goal combat-arm LIGHTCAV)
  1131.     )
  1132. =>
  1133.     (set-strategic-number sn-number-forward-builders 1)
  1134. )
  1135.  
  1136. (defrule
  1137.     (goal 1 10)
  1138.     (goal rush-control RUSHING)
  1139.     (difficulty <= moderate)
  1140.     (building-type-count archery-range == 1)
  1141.     (building-type-count-total market > 0)
  1142.     (strategic-number sn-number-forward-builders == 0)
  1143.     (unit-type-count villager >= civ-dark-rush)
  1144.     (or
  1145.         (goal combat-arm CAVARCHER)
  1146.         (goal combat-arm ARCHER)
  1147.     )
  1148. =>
  1149.     (set-strategic-number sn-number-forward-builders 1)
  1150. )
  1151.  
  1152. (defrule
  1153.     (goal 1 10)
  1154.     (goal rush-control RUSHING)
  1155.     (difficulty <= hard)
  1156.     (building-type-count siege-workshop == 1)
  1157.     (strategic-number sn-number-forward-builders == 0)
  1158.     (unit-type-count villager >= civ-dark-rush)
  1159.     (or
  1160.         (or
  1161.             (building-type-count-total archery-range > 1)
  1162.             (building-type-count-total castle > 1)
  1163.         )
  1164.         (or
  1165.             (building-type-count-total barracks > 1)
  1166.             (building-type-count-total stable > 1)
  1167.         )
  1168.     )
  1169. =>
  1170.     (set-strategic-number sn-number-forward-builders 1)
  1171. )
  1172.  
  1173. (defrule
  1174.     (goal 1 10)
  1175.     (goal rush-control RUSHING)
  1176.     (difficulty <= hard)
  1177.     (goal castle-attempt 2)
  1178.     (unit-type-count villager > civ-dark-rush)
  1179.     (building-type-count-total castle < 3)
  1180.     (can-build-with-escrow castle)
  1181. =>
  1182.     (set-strategic-number sn-number-forward-builders 3)
  1183. )
  1184.  
  1185. (defrule
  1186.     (goal 1 10)
  1187.     (or
  1188.         (or
  1189.             (unit-type-count transport-ship == 0)
  1190.             (attack-soldier-count < ten-percent-pop)
  1191.         )
  1192.         (or
  1193.             (or
  1194.                 (unit-type-count villager < 10)
  1195.                 (not (goal rush-control RUSHING) )
  1196.             )
  1197.             (or
  1198.                 (goal military-parity NO)
  1199.                 (town-under-attack)
  1200.             )
  1201.         )
  1202.     )
  1203.     (strategic-number sn-number-forward-builders >= 1)
  1204. =>
  1205.     (set-strategic-number sn-number-forward-builders 0)
  1206. )
  1207.  
  1208. (defrule
  1209.     (goal rush-control RUSHING)
  1210.     (goal castle-attempt 2)
  1211.     (difficulty <= hard)
  1212.     (unit-type-count villager > civ-feudal)
  1213.     (building-type-count-total castle < 3)
  1214.     (can-build-with-escrow castle)
  1215. =>
  1216.     (release-escrow stone)
  1217.     (build-forward castle)
  1218. )
  1219.  
  1220. (defrule
  1221.     (goal castle-attempt 2)
  1222.     (difficulty <= hard)
  1223.     (unit-type-count villager > civ-dark-rush)
  1224.     (building-type-count-total castle < 3)
  1225.     (can-build-with-escrow castle)
  1226.     (nor
  1227.         (goal wonder-attempt POSSIBLE)
  1228.         (goal rush-control RUSHING)
  1229.     )
  1230. =>
  1231.     (release-escrow stone)
  1232.     (build castle)
  1233. )
  1234.  
  1235. (defrule
  1236.     (difficulty <= moderate)
  1237.     (unit-type-count villager > civ-dark)
  1238.     (building-type-count barracks < 3)
  1239.     (building-type-count barracks == 1)
  1240.     (can-build barracks)
  1241.     (nor
  1242.         (goal rush-control CASTLE)
  1243.         (goal rush-control IMPERIAL)
  1244.     )
  1245.     (or
  1246.         (goal combat-arm INFANTRY)
  1247.         (current-age == dark-age)
  1248.     )
  1249.     (or
  1250.         (goal rush-control RUSHING)
  1251.         (goal rush-control FEUDAL)
  1252.     )
  1253. =>
  1254.     (build-forward barracks)
  1255. )
  1256.  
  1257. (defrule
  1258.     (difficulty <= moderate)
  1259.     (building-type-count barracks < 3)
  1260.     (current-age > feudal-age)
  1261.     (can-build barracks)
  1262.     (not (goal rush-control IMPERIAL) )
  1263.     (or
  1264.         (goal combat-arm INFANTRY)
  1265.         (goal combat-supp INFANTRY)
  1266.     )
  1267. =>
  1268.     (build barracks)
  1269. )
  1270.  
  1271. (defrule
  1272.     (goal rush-control RUSHING)
  1273.     (difficulty <= moderate)
  1274.     (building-type-count archery-range == 1)
  1275.     (building-type-count-total market > 0)
  1276.     (unit-type-count villager > civ-dark)
  1277.     (can-build archery-range)
  1278.     (or
  1279.         (goal combat-arm CAVARCHER)
  1280.         (goal combat-arm ARCHER)
  1281.     )
  1282. =>
  1283.     (build-forward archery-range)
  1284. )
  1285.  
  1286. (defrule
  1287.     (difficulty <= moderate)
  1288.     (building-type-count archery-range < 3)
  1289.     (building-type-count-total market > 0)
  1290.     (can-build archery-range)
  1291.     (nor
  1292.         (goal rush-control RUSHING)
  1293.         (goal rush-control IMPERIAL) 
  1294.     )
  1295.     (or
  1296.         (or
  1297.             (goal combat-arm CAVARCHER)
  1298.             (goal combat-arm ARCHER)
  1299.         )
  1300.         (or
  1301.             (goal combat-supp CAVARCHER)
  1302.             (goal combat-supp ARCHER)
  1303.         )
  1304.     )
  1305. =>
  1306.     (build archery-range)
  1307. )
  1308.  
  1309. (defrule
  1310.     (goal rush-control RUSHING)
  1311.     (difficulty <= moderate)
  1312.     (building-type-count stable == 1)
  1313.     (building-type-count-total university > 0)
  1314.     (unit-type-count villager > civ-dark)
  1315.     (can-build stable)
  1316.     (or
  1317.         (goal combat-arm CAVALRY)
  1318.         (goal combat-arm LIGHTCAV)
  1319.     )
  1320. =>
  1321.     (build-forward stable)
  1322. )
  1323.  
  1324. (defrule
  1325.     (difficulty <= moderate)
  1326.     (building-type-count stable < 3)
  1327.     (building-type-count-total university > 0)
  1328.     (can-build stable)
  1329.     (nor
  1330.         (goal rush-control RUSHING) 
  1331.         (goal rush-control IMPERIAL)
  1332.     )
  1333.     (or
  1334.         (or
  1335.             (goal combat-arm CAVALRY)
  1336.             (goal combat-arm LIGHTCAV)
  1337.         )
  1338.         (or
  1339.             (goal combat-supp CAVALRY)
  1340.             (goal combat-supp LIGHTCAV)
  1341.         )
  1342.     )
  1343. =>
  1344.     (build stable)
  1345. )
  1346.  
  1347. (defrule
  1348.     (goal rush-control RUSHING)
  1349.     (difficulty <= hard)
  1350.     (building-type-count siege-workshop == 1)
  1351.     (can-build siege-workshop)
  1352.     (unit-type-count villager > civ-feudal)
  1353.     (or
  1354.         (or
  1355.             (building-type-count-total archery-range > 1)
  1356.             (building-type-count-total castle > 1)
  1357.         )
  1358.         (or
  1359.             (building-type-count-total barracks > 1)
  1360.             (building-type-count-total stable > 1)
  1361.         )
  1362.     )
  1363. =>
  1364.     (build-forward siege-workshop)
  1365. )
  1366.  
  1367. (defrule
  1368.     (difficulty <= hard)
  1369.     (building-type-count siege-workshop == 1)
  1370.     (can-build siege-workshop)
  1371.     (or
  1372.         (or
  1373.             (building-type-count-total archery-range > 1)
  1374.             (building-type-count-total castle > 1)
  1375.         )
  1376.         (or
  1377.             (building-type-count-total barracks > 1)
  1378.             (building-type-count-total stable > 1)
  1379.         )
  1380.     )
  1381.     (not (goal rush-control RUSHING) )
  1382. =>
  1383.     (build siege-workshop)
  1384. )
  1385.  
  1386. ;**************************************
  1387.